package scenic.filter;

/**
 * Tent filter kernel.
 */
public class TentKernel extends SeparableKernel {
	private static TentKernel kernel;
	
	private TentKernel() {
	}
	
	public double getValue(double x) {
		if(x < -0.5 || x > 0.5)
			return 0.0;
		return (1.0 - Math.abs(x * 2.0)) * 2;
	}
	
	public static TentKernel getKernel() {
		if(kernel == null)
			kernel = new TentKernel();
		return kernel;
	}

}
